#include <functional>
#include <iostream>
#include "log.hpp"

// typedef std::function<int(int,int)> func_t;
using func_t  = std::function<void (int,uint16_t,std::string,std::string)>;

class Task
{
public:
    Task(){}
    Task(int sock,uint16_t port,std::string ip,func_t func):
    _sock(sock),_port(port),_ip(ip),_f(func)
    {}

    void operator()(const std::string& name)
    {
        //std::cout << "线程" << name << "处理完毕：" << _x << "+" << _y << "=" << _f(_x,_y) << std::endl;
        //logMessage(WARNING,"线程%s 处理完毕：%d+%d = %d",name.c_str(),_x,_y,_f(_x,_y));
        _f(_sock,_port,_ip,name);
    }

private:
    int _sock;
    uint16_t _port;
    std::string _ip;
    func_t _f;
};